Skip to content

test(language/lint): add unit tests for empty-block pass#48

Merged
awli merged 1 commit into
salesforce:mainfrom
dsorajisto:test-empty-block-lint-pass
Jun 10, 2026
Merged

test(language/lint): add unit tests for empty-block pass#48
awli merged 1 commit into
salesforce:mainfrom
dsorajisto:test-empty-block-lint-pass

Conversation

@dsorajisto

Copy link
Copy Markdown
Contributor

What

Adds 5 unit tests for the empty-block lint pass in packages/language/src/lint/empty-block.ts. Brings the rule's test count from 0 to 5.

Why

The empty-block rule flags empty inputs: and outputs: blocks (a common authoring mistake) but had no tests pinning down its behavior. This change closes the gap using the same pattern PR #38 (required-fields.test.ts) established for lint-rule tests.

How

New test file at packages/language/src/lint/empty-block.test.ts using vitest. Follows required-fields.test.ts exactly: single describe block, flat it cases, shared getDiagnostics helper, ActionsBlock-based test schema.

The 5 cases:

  1. Flags a bare inputs: with no entries
  2. Does not flag a populated inputs: block
  3. Flags a bare outputs: with no entries
  4. Reports two diagnostics when both inputs: and outputs: are empty
  5. Reports one diagnostic per action when multiple actions have empty blocks

Test Plan

pnpm --filter @agentscript/language test empty-block

Result:

✓ src/lint/empty-block.test.ts (5 tests) 11ms
Test Files  1 passed (1)
     Tests  5 passed (5)
  • pnpm --filter @agentscript/language test empty-block — 5/5 passing
  • npx eslint --config eslint.config.js packages/language/src/lint/empty-block.test.ts — exit 0
  • New/updated tests cover the change — N/A (this PR is the tests)

Checklist

  • My code follows the project's coding style
  • I have reviewed my own diff
  • I have added/updated documentation as needed
  • This change does not introduce new warnings

Adds 5 unit tests for the empty-block lint pass in
packages/language/src/lint/empty-block.ts, which flags `inputs:`
or `outputs:` blocks that have no entries.

Coverage:
- Bare `inputs:` and `outputs:` (null-ish value) → flagged
- Populated blocks → not flagged
- Both blocks empty → two diagnostics
- Multiple actions → one diagnostic per affected action

Follows the same test pattern as required-fields.test.ts (salesforce#38).

All tests pass via:

    pnpm --filter @agentscript/language test empty-block

@awli awli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@awli awli merged commit ff05329 into salesforce:main Jun 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants